cmake_minimum_required(VERSION 3.12)

include(glad/CMakeLists.txt)
include(Buffer/CMakeLists.txt)
include(Program/CMakeLists.txt)
include(Scene/CMakeLists.txt)
include(Model/CMakeLists.txt)
include(Renderer/CMakeLists.txt)
include(Material/CMakeLists.txt)
include(Geometry/CMakeLists.txt)
include(App/CMakeLists.txt)

set(CMAKE_CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/src)

set(_INC
    ${CMAKE_CURRENT_SOURCE_DIR}/MatrixSystem.hpp
    ${CMAKE_CURRENT_SOURCE_DIR}/Camera.hpp
    ${CMAKE_CURRENT_SOURCE_DIR}/FirstPersonCamera.hpp
    ${CMAKE_CURRENT_SOURCE_DIR}/MeshLoader.hpp
    ${CMAKE_CURRENT_SOURCE_DIR}/Model.hpp
    ${CMAKE_CURRENT_SOURCE_DIR}/AttriBinding.hpp
    ${CMAKE_CURRENT_SOURCE_DIR}/GLDebugger.hpp
    ${CMAKE_CURRENT_SOURCE_DIR}/Math.hpp
    ${CMAKE_CURRENT_SOURCE_DIR}/Geometry/Plane.hpp
    ${CMAKE_CURRENT_SOURCE_DIR}/Geometry/Shape.hpp
    ${CMAKE_CURRENT_SOURCE_DIR}/Platform.hpp
    ${CMAKE_CURRENT_SOURCE_DIR}/FileUtil.hpp
    ${CMAKE_CURRENT_SOURCE_DIR}/SceneView.hpp
    ${CMAKE_CURRENT_SOURCE_DIR}/UserInput.hpp
    ${CMAKE_CURRENT_SOURCE_DIR}/Window.hpp
    ${BUFFER_INC}
    ${PROGRAM_INC}
    ${SCENE_INC}
    ${MODEL_INC}
    ${RENDERER_INC}
    ${MATERIAL_INC}
    ${GLAD_INC}
    ${GEOMETRY_INC}
    ${APP_INC}
)

set(_SRC
    ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp
    ${CMAKE_CURRENT_SOURCE_DIR}/imgui_impl_glfw.cpp
    ${CMAKE_CURRENT_SOURCE_DIR}/imgui_impl_opengl3.cpp
    ${CMAKE_CURRENT_SOURCE_DIR}/MatrixSystem.cpp
    ${CMAKE_CURRENT_SOURCE_DIR}/FirstPersonCamera.cpp
    ${CMAKE_CURRENT_SOURCE_DIR}/Model.cpp
    ${CMAKE_CURRENT_SOURCE_DIR}/GLDebugger.cpp
    ${CMAKE_CURRENT_SOURCE_DIR}/AttriBinding.cpp
    ${CMAKE_CURRENT_SOURCE_DIR}/Geometry/GeometryImp.cpp
    ${CMAKE_CURRENT_SOURCE_DIR}/FileUtil.cpp
    ${CMAKE_CURRENT_SOURCE_DIR}/Window.cpp
    ${BUFFER_SRC}
    ${PROGRAM_SRC}
    ${SCENE_SRC}
    ${MODEL_SRC}
    ${RENDERER_SRC}
    ${MATERIAL_SRC}
    ${GLAD_SRC}
    ${APP_SRC}
    ${GEOMETRY_SRC}
)

set(FILE ${_INC} ${_SRC})

set(PRECOMPILED_HEADERS 
    ${CMAKE_CURRENT_SOURCE_DIR}/Math.hpp
    ${CMAKE_CURRENT_SOURCE_DIR}/Platform.hpp
)

add_executable(App ${FILE})
target_include_directories(App PUBLIC ${CONAN_INCLUDE_DIRS} ${CONAN_SRC_DIRS_IMGUI}/bindings)
target_include_directories(App PUBLIC ${GLAD_INC_DIRS})
target_precompile_headers(App PUBLIC ${PRECOMPILED_HEADERS})

target_link_libraries(App PUBLIC ${CONAN_LIBS})
